﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FantastPlatform.Community.IMode;
using FantastPlatform.Community.Model;
using FantastPlatform.Framework.Service;
using FantastPlatform.Community.IService;
using NHibernate;
using NHibernate.Criterion;

namespace FantastPlatform.Community.Service
{
    public class CaseCallBackService : DataService<ICaseCallBack, CaseCallBack>, ICaseCallBackService
    {
        public ICaseCallBack GetCaseCallBackByCaseId(int caseId)
        {
            ICriteria criteria = Session.CreateCriteria(typeof(CaseCallBack));
            criteria.Add(Expression.Eq("CaseId", caseId)).Add(Expression.Eq("Enable", true));
            IList<ICaseCallBack> callBackList = criteria.List<ICaseCallBack>();
            if (callBackList.Count > 0)
                return callBackList[0];
            else
                return null ;
        }
    }
}
